function nodeSuccessfullyRepositioned(arg, context)
{
    //alert(arg);
}

function nodeDeleteClicked(arg, context)
{
    //alert(arg);
}

function nodeDoubleClicked(arg, context)
{
    //serverside mapping
    //nodeClicked.ModalDialogueHtmlToDisplay + "%%" + nodeClicked.ModalDialogueWidth + "%%" + nodeClicked.ModalDialogueHeight;
    //0 == content
    //1 == navigate url
    //2 == width
    //3 == height
    //4 == scripts to execute when box is shown
    //5 == scripts to execute when box is closed
    var showDetail = arg.split('##');
    showModal(showDetail[0], showDetail[1], showDetail[2], showDetail[3], showDetail[4], showDetail[5]);
}

function showModal(htm, navUrl, sWidth, sHeight, openScripts, closeScripts)
{
    var wdth = 0;
    var hgt = 0;
    
    if (sWidth.indexOf('px') > -1)
    {
        wdth = sWidth.replace('px', '');
    }
    else if (sWidth.indexOf('%') > -1)
    {
        var pWdth = sWidth.replace('%','');
        wdth = screen.width * (pWdth/100);
    }
    
    if (sHeight.indexOf('px') > -1)
    {
        hgt = sHeight.replace('px', '');
    }
    else if (sHeight.indexOf('%') > -1)
    {
        var pHgt = sHeight.replace('%','');
        hgt = screen.height * (pHgt/100);
    }
        
    if (navUrl != '')
    {
        htm = '<table style=\'padding: 0px 0px 0px 0px; margin:0px 0px 0px 0px;margin-right:auto;margin-left:auto;\'><tr><td><iframe src=\'' + navUrl + '\' style=\'width:' + (wdth - 70) + 'px;height:' + (hgt - 60) + 'px;\' scrolling=\'auto\' frameborder=\'no\'></iframe></td><td valign=\'top\' style=\'vertial-align:top\'><a href=\'#\' onclick=\'Modalbox.hide(); return false;\'>X</a></td></tr></table>';
    }
    
    if (hgt == 0)
    {    
        if (openScripts != '' && closeScripts != '')
        {
            Modalbox.show(htm, {title: ' ', afterLoad: function() { eval(openScripts) }, afterHide: function() { eval(closeScripts) }, width: wdth } );
        }
        else if (openScripts != '')
        {
            Modalbox.show(htm, {title: ' ', afterLoad: function() { eval(openScripts) }, width: wdth });
        }
        else if (closeScripts != '')
        {
            Modalbox.show(htm, {title: ' ', afterHide: function() { eval(closeScripts) },  width: wdth });
        }
        else
        {    
            Modalbox.show(htm, {title: ' ', width: wdth });
        }
     }
     else
     {
        if (openScripts != '' && closeScripts != '')
        {
            Modalbox.show(htm, {title: ' ', afterLoad: function() { eval(openScripts) }, afterHide: function() { eval(closeScripts) }, width: wdth, height: hgt } );
        }
        else if (openScripts != '')
        {
            Modalbox.show(htm, {title: ' ', afterLoad: function() { eval(openScripts) }, width: wdth, height: hgt });
        }
        else if (closeScripts != '')
        {
            Modalbox.show(htm, {title: ' ', afterHide: function() { eval(closeScripts) },  width: wdth, height: hgt });
        }
        else
        {    
            Modalbox.show(htm, {title: ' ', width: wdth, height: hgt });
        }
     }
}

function ReturnNodeStatuses(arg, context)
{
    //arg comes in = div1|div2%%div1~w~|warning for div1@div2~e~|error for div2
    //reset all backgrounds
    var ix, dxx;
    var allData = arg.split('##');
    var allDivs = allData[0].split('|');
    for (dxx = 0; dxx < allDivs.length; dxx++)
    {
        if (document.getElementById(allDivs[dxx]))
        {
            document.getElementById(allDivs[dxx]).className = ''; 
            //document.getElementById(allDivs[dxx] + 'MessageText').innerHTML = '';
        }
    }
    
    var splitUpdates = allData[1].split('@');
    for (ix = 0; ix < splitUpdates.length; ix++)
    {
        var getIds = splitUpdates[ix].split('|');
        if (getIds[0].indexOf('~w~') > -1)
        {
            if (document.getElementById(getIds[0].replace('~w~','')))
            {
                document.getElementById(getIds[0].replace('~w~','')).className = returnClassName('warning');
                //new Effect.Pulsate(getIds[0].replace('~w~',''), {duration: 2, from: .7});
                document.getElementById(getIds[0].replace('~w~','') + 'MessageText').innerHTML = getIds[1] + '##' + document.getElementById(getIds[0].replace('~w~','') + 'MessageText').innerHTML;
            }
        }
        else if (getIds[0].indexOf('~e~') > -1)
        {
            if (document.getElementById(getIds[0].replace('~e~','')))
            {
                document.getElementById(getIds[0].replace('~e~','')).className = returnClassName('error');
                //new Effect.Pulsate(getIds[0].replace('~e~',''), {duration: 2, from: .2});
                document.getElementById(getIds[0].replace('~e~','') + 'MessageText').innerHTML = getIds[1] + '##' + document.getElementById(getIds[0].replace('~e~','') + 'MessageText').innerHTML;
            }
        }
        else if (getIds[0].indexOf('~i~') > -1)
        {
            if (document.getElementById(getIds[0].replace('~i~','')))
            {
                document.getElementById(getIds[0].replace('~i~','')).className = returnClassName('info');
                document.getElementById(getIds[0].replace('~i~','') + 'MessageText').innerHTML = getIds[1] + '##' + document.getElementById(getIds[0].replace('~i~','') + 'MessageText').innerHTML;
            }
        }
    }
}

function nodeDetailsClicked(arg, context)
{
    //serverside mapping
    //nodeClicked.ModalDialogueHtmlToDisplay + "%%" + nodeClicked.ModalDialogueWidth + "%%" + nodeClicked.ModalDialogueHeight;
     //0 == content
    //1 == navigate url
    //2 == width
    //3 == height
    //4 == scripts to execute when box is shown
    //5 == scripts to execute when box is closed
    var showDetail = arg.split('##');
    showModal(showDetail[0], showDetail[1], showDetail[2], showDetail[3], showDetail[4], showDetail[5]);
}